<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link href="<%=request.getContextPath()%>/css/global.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath() %>/js/easyui/themes/metro/easyui.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath() %>/js/date/skin/WdatePicker.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/global.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/easyui/easyui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/date/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.js"></script>
<script type="text/javascript">

$(function(){

	condition();

	$('#merNo').autocomplete({
    	serviceUrl: '<%=request.getContextPath()%>/merchant_auto.html',
    	minChars:1,
    	paramName:'merNo',
    	transformResult: function(response) {
		　　return {
		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
		　　　　　　return { value: dataItem.merNo, data: dataItem.merName};
		　　　　})
		　　};
		},
    	formatResult:function (suggestion, currentValue) {
    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
    	}
	});
	
	$('#subNo').autocomplete({
    	serviceUrl: '<%=request.getContextPath()%>/subject_auto.html',
    	minChars:1,
    	paramName:'subNo',
    	transformResult: function(response) {
		　　return {
		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
		　　　　　　return { value: dataItem.subNo, data: dataItem.subName};
		　　　　})
		　　};
		},
    	formatResult:function (suggestion, currentValue) {
    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
    	}
	});
	
	$("#dataTable").datagrid({
		toolbar: '#dataSearch',
		fitColumns:true,
		striped: true, 
		singleSelect:false,
		pagination:true,
		rownumbers:true,
		SelectOnCheck:true,
		CheckOnSelect:true,
        onSelect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onSelectAll: function(rows){
        	var nos="";
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselectAll: function(rows){
			$("#keys").val("");
    	}
	});
	
	$('#dataTable').datagrid('getPager').pagination({
		total:<s:property value="pageInfo.pageRecord"/>,
		pageNumber:<s:property value="pageInfo.pageIndex"/>,
		pageSize:<s:property value="pageInfo.pageSize"/>,
		pageList: [20,50,100] ,
		onSelectPage:function(pageNumber,pageSize){  
			toPage(pageNumber,pageSize);
		},
		onRefresh:function(pageNumber,pageSize){  
			location.reload();
		}});
});

function condition(){
	if($("#high").prop("checked")){
		$(".ac").show();
	}else{
		$(".ac").hide();
	}
}
function audit(){
	if($("#keys").val()==""){
		$.MsgBox.Alert('提示', '请先选择一项');
		return ;
	}
	$.ajax
		({
	  url:"website_saveverify.html",
	  cache: false,
	  async: false,
	  type: "POST",
	  data:"webNos="+$("#keys").val()+"&webState="+$("input[name='state']:checked").val()+"&webDescript="+encodeURIComponent($("#descript").val())+"&webRemark="+encodeURIComponent($("#remark").val())+"&webValidity="+encodeURIComponent($("#validity").val()),
	  success: function(html){
	  	if(html=="succ"){
	  		location.reload();
	  	}
	  	else{
	  		$.MsgBox.Alert('提示', '操作失败,请联系管理员');
	  	}
	  }
	}); 
}
</script>
</head>
<body >
<div id="dataSearch" >    
<form id="sform" action="website_listverify.html" method="get" enctype="multipart/form-data">
<table style="width: 100%;">
<tr>
<td height="25" >
	<b>操作说明:网站编号由商户号加子账户号加序号组成</b> 
</td>
</tr>
<tr><td height="30" >
<s:textfield  id="merNo" name="merNo" placeholder="商户编号" ></s:textfield>
<s:textfield  id="webAddress" name="webAddress" placeholder="网站地址" cssStyle="width:240px;"></s:textfield>
<s:textfield  id="webDescript" name="webDescript" placeholder="网站描述" cssStyle="width:240px;"></s:textfield>
<s:textfield  id="webValidity" name="webValidity" placeholder="有效天数" ></s:textfield>
<s:select id="webState" name="webState" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="网站状态"/>
<s:select id="webVstate" name="webVstate" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="审核状态"/>

<input type="button" class="submit" value="提交查询" onclick="sform.submit();"/>
<input type="button" class="submit" value="高级搜索" onclick="$('#high').click();"/>
<s:checkbox id="high" name="high"  onclick="condition();" cssStyle="display:none;"></s:checkbox>
</td>
</tr>
<tr><td><hr/></td></tr>
<tr class="ac"  style="display: none;"><td height="30" >

<s:textfield  id="webDateTop"  name="webDateTop" placeholder="创建日期起"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="webDateTop" format="yyyy-MM-dd"/></s:param></s:textfield>
 - 
<s:textfield  id="webDateEnd"  name="webDateEnd" placeholder="创建日期止"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="webDateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>
<s:textfield  id="webVdateTop"  name="webVdateTop" placeholder="审核日期起"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="webVdateTop" format="yyyy-MM-dd"/></s:param></s:textfield>
 - 
<s:textfield  id="webVdateEnd"  name="webVdateEnd" placeholder="审核日期止"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="webVdateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>
<s:textfield  id="webRemark" name="webRemark" placeholder="网站备注" cssStyle="width:240px;"></s:textfield>

</td>
</tr>
<tr class="ac"  style="display: none;"><td><hr/></td></tr>
<tr>
<td height="30" >
	<input type="hidden"  id="keys" name="keys"  value=""/>
		<input type="button" class="submit" value="编号排序" onclick="toSort('sortField','webNo')"/>
		<input type="button" class="submit" value="创建日期" onclick="toSort('sortField','webDate')"/>
		<input type="button" class="submit" value="审核日期" onclick="toSort('sortField','webVdate')"/>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="升序排列" onclick="toSort('sortOrder','true')"/>
		<input type="button" class="submit" value="降序排列" onclick="toSort('sortOrder','false')"/>
</td>
</tr>
<tr><td><hr/></td></tr>
</table>
</form>
<table style="width: 100%;">
<tr>
<td height="30" >
		<input type="button" class="submit" value="批量审核" onclick="audit();"/>
		<s:radio id="state" name="state" list="#{'0':'拒绝','1':'通过'}" value="1"></s:radio>
		有效天数 : <input type="text"  id="validity" value="<s:property value="@dicts.GlobalDict@YEAR"/>" />
		网站描述 : <input type="text"  id="descript"  style="width:240px;" />
		审核备注 : <input type="text"  id="remark"  style="width:360px;" />
</td>
</tr>
</table>
</div>

<table id="dataTable" style="width: 100%;" class="easyui-datagrid" >
<thead>
<tr>
<th data-options="field:'ck'" checkbox="true"></th>
<th data-options="field:'webNo', width:'10%',align:'left' , halign: 'left'">编号</th>
<th data-options="field:'webSign', width:'8%',align:'left' , halign: 'left'">网站标识</th>
<th data-options="field:'webAddress', width:'15%',align:'left' , halign: 'left'">网站地址</th>
<th data-options="field:'webDescript', width:'10%',align:'left' , halign: 'left'">网站描述</th>
<th data-options="field:'webValidity', width:'5%',align:'left' , halign: 'left'">有效天数</th>
<th data-options="field:'webState', width:'2%',align:'left' , halign: 'left'">通</th>
<th data-options="field:'webDate', width:'12%',align:'left' , halign: 'left'">创建日期</th>
<th data-options="field:'webVstate', width:'2%',align:'left' , halign: 'left'">审</th>
<th data-options="field:'webVdate', width:'12%',align:'left' , halign: 'left'">审核日期</th>
<th data-options="field:'webRemark', width:'200',align:'left' , halign: 'left'">网站备注</th>

</tr>
</thead>
<tbody>
<s:iterator value="websiteList" id="show" status="seq">
<tr>
<td><s:property value="#show.webNo"/></td>
<td><s:property value="#show.webNo"/></td>
<td><s:property value="#show.webSign"/></td>
<td><s:property value="#show.webAddress"/></td>
<td><s:property value="#show.webDescript"/></td>
<td><s:text name="global.format.count"><s:param value="#show.webValidity"/></s:text> 天</td>
<td><s:if test="#show.webState==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:text name="global.format.dateminute"><s:param value="#show.webDate"/></s:text>
<td><s:if test="#show.webVstate==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:text name="global.format.dateminute"><s:param value="#show.webVdate"/></s:text>
<td><s:property value="#show.webRemark"/></td>

</tr>
</s:iterator>
</tbody>
</table>
<br/>
<br/>
<br/>
</body>
</html>
